import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PopularizeVO, PopularizeForm, PopularizeQuery } from '@/api/system/popularize/types';

/**
 * 查询科普管理列表
 * @param query
 * @returns {*}
 */

export const listPopularize = (query?: PopularizeQuery): AxiosPromise<PopularizeVO[]> => {
  return request({
    url: '/system/popularize/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询科普管理详细
 * @param id
 */
export const getPopularize = (id: string | number): AxiosPromise<PopularizeVO> => {
  return request({
    url: '/system/popularize/' + id,
    method: 'get'
  });
};

/**
 * 新增科普管理
 * @param data
 */
export const addPopularize = (data: PopularizeForm) => {
  return request({
    url: '/system/popularize',
    method: 'post',
    data: data
  });
};

/**
 * 修改科普管理
 * @param data
 */
export const updatePopularize = (data: PopularizeForm) => {
  return request({
    url: '/system/popularize',
    method: 'put',
    data: data
  });
};

/**
 * 删除科普管理
 * @param id
 */
export const delPopularize = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/popularize/' + id,
    method: 'delete'
  });
};
